home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc51bugs.zip / Q33901 < prev    next >
Text File  |  1988-08-09  |  2KB  |  53 lines

  1. Q33901 Code Generation Problem Caused by /Oal Optimization
  2. C Compiler
  3. 5.10   | 5.10
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.    A structure is allocated in long heap by using the C run-time
  8. routine malloc. A local structure is declared allocating the
  9. structure in the default data segment.
  10.    The optimization problem occurs inside a for loop on the assignment
  11. of the local structure member to the far-allocated structure member.
  12. The C source code was compiled with alias checking and /Oal loop
  13. optimization.
  14.    The code generated on the assignment is incorrect. The segment
  15. register DS is incorrectly set equal to ES.
  16.    A workaround is to use an optimization switch not containing alias
  17. checking or loop optimization. For example, the optimization switches
  18. /Oait or /Olit can be used, but /Oailt cannot be used.
  19.     Microsoft has confirmed this to be a problem in Version 5.10 of
  20. the C Compiler. We are researching this problem and will post new
  21. information as it becomes available.
  22.  
  23. More Information:
  24.    The following program illustrates the problem:
  25.  
  26. #include <malloc.h>
  27.  
  28. typedef struct { double i; double r; } complex;
  29. main(){
  30. complex foo;
  31. foo.i=999.999;
  32. foo.r=999.999;
  33. sub(foo);
  34. }
  35.  
  36. int sub(in)
  37. complex in;
  38. {
  39.         int x;
  40.         complex *cp;
  41.  
  42.         cp = malloc(8192);
  43.         for (x=0;x<512;x++) {
  44.           cp[x].i=x;
  45.           cp[x].r=x;
  46.                 cp[x].i = in.i;
  47.                 cp[x].r = in.r;
  48.         }
  49. }
  50.  
  51. Keywords:  buglist5.10
  52. Updated  88/08/09 05:59
  53.